php sort array by value length

39

function sortByLength($a,$b){
    return strlen($b)-strlen($a);
}
usort($array,'sortByLength');

Comments

Submit
0 Comments